<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('订单列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <input type="hidden" name="orderType" th:value="${orderType}"/>

                    <ul>
                        <li class="select-time">
                            <label>日期： </label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]" lay-key="1" th:value="${beginTime}">
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]" lay-key="2" th:value="${endTime}">
                        </li>
                        <li>
                            单号：<input type="text" name="orderCode"/>
                        </li>

                        <li>
                            经手人：<input type="text" name="createBy"/>
                        </li>


                        <!--<li>
                            出库类型：<input type="text" name="outputType"/>
                        </li>

                        <li>
                            0：默认 1：执行中 2：已完成：<input type="text" name="status"/>
                        </li>

                        <li>
                            创建时间：<input type="text" name="createTime"/>
                        </li>

                        <li>
                            备注：<input type="text" name="remark"/>
                        </li>-->

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

       <!-- <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:ncOrder:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="system:ncOrder:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:ncOrder:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:ncOrder:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>-->
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncOrder:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncOrder:remove')}]];
    var prefix = ctx + "system/ncOrder";
    var orderType = [[${orderType}]];
    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add?orderType=" + orderType,
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "订单",
            showExport: false,
            showSearch: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            sortName:'createTime',
            sortOrder:'desc',
            columns: [
                {
                    title: '序号',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
               /* {
                checkbox: true
            },*/
                {
                    field: 'orderId',
                    title: '单子id',
                    visible: false
                },
                {
                    field: 'orderCode',
                    title: '单号',
                    sortable: true
                },
                /*{
                    field: 'orderTime',
                    title: '时间',
                    sortable: true
                },*/
                {
                    field: 'createTime',
                    title: '时间',
                    sortable: true
                },
                {
                    field: 'createBy',
                    title: '经手人',
                    sortable: true
                },
                /*{
                    field: 'outputType',
                    title: '出库类型',
                    sortable: true
                },
                {
                    field: 'status',
                    title: '状态',
                    sortable: true
                },*/
                {
                    field: 'remark',
                    title: '备注',
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-primary btn-xs " href="javascript:void(0)" onclick="showOrderInfo(\'' + row.orderId + '\')"><i class="fa fa-info"></i>预览</a> ');
                        // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.orderId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);


    });

    /*查看订单详情列表*/
    function showOrderInfo(id) {
        var url = prefix + "/orderList?orderId=" + id
        $.modal.openTab("订单详情", url);
    }
    /**
     * 单子类型： 1：生产计划单 2：育苗计划单 3：订单记录单 4：检测记录单 5：菜房1：入库单 6：菜房1：出库单 7：菜房2：入库单 8：菜房2：出库单
     * 9：植保记录单 10：牛舍入库单 11：牛舍：出库单 12：鸡舍入库单 13：鸡舍出库单 14：牛舍诊疗单 15：牛舍免疫单 ：16：牛舍巡视单  17：鸡舍诊疗单 18：鸡舍免疫单 ：19：鸡舍巡视单:  20: 菜房2入库  21:菜房2出库
     */
    var orderType = [[${orderType}]];
    switch (orderType) {
        case 1:
            setTitle("生产计划单",true)
            break;
        case 2:
            setTitle("育苗计划单",true)
            break;
        case 3:
            setTitle("订单记录单",true)
            break;
        case 4:
            setTitle("检测记录单",true)
            break;
        case 5:
            setTitle("菜房1入库单",true)
            break;
        case 6:
            setTitle("菜房1出库单",true)
            break;
        case 7:
            setTitle("菜房2入库单",true)
            break;
        case 8:
            setTitle("菜房2出库单",true)
            break;
        case 9:
            setTitle("植保记录单",true)
            break;
        case 10:
            setTitle("牛舍入库单",true)
            break;
        case 11:
            setTitle("牛舍出库单",true)
            break;
        case 12:
            setTitle("鸡舍入库单",true)
            break;
        case 13:
            setTitle("鸡舍出库单",true)
            break;
        case 14:
            setTitle("牛舍诊疗单",true)
            break;
        case 15:
            setTitle("牛舍免疫单",true)
            break;
        case 16:
            setTitle("牛舍巡视单",true)
            break;
        case 17:
            setTitle("鸡舍诊疗单",true)
            break;
        case 18:
            setTitle("鸡舍免疫单",true)
            break;
        case 19:
            setTitle("鸡舍巡视单",true)
            break;


    }

</script>
</body>
</html>